package net.qhzw.vip.qiyu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.qhzw.vip.qiyu.entity.SysContract;
import net.qhzw.vip.qiyu.mapper.SysContractMapper;
import net.qhzw.vip.qiyu.service.DtsCarRetreatService;
import net.qhzw.vip.qiyu.service.SysCommunityService;
import net.qhzw.vip.qiyu.service.SysContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class SysContractServiceImpl extends ServiceImpl<SysContractMapper, SysContract> implements SysContractService {

    @Autowired
    private SysCommunityService communityService;

    @Autowired
    private DtsCarRetreatService dtsCarRetreatService;


    @Override
    public Map<String, String> getExchange(Long userId) {
        SysContract sysContract = getOne(new LambdaQueryWrapper<SysContract>().eq(SysContract::getType, 1));
        Map<String, String> result = new HashMap<>();
        if (sysContract != null) {
            result.put("exchangeMobile", sysContract.getExchangeMobile());
            result.put("complaintMobile", sysContract.getComplaintMobile());
        }
        String siteMobile = "";
        if (userId != null) {
            siteMobile = communityService.getSiteMobile(userId);
        }
        result.put("siteMobile", siteMobile);
        return result;
    }
}
